'use strict'
module.exports = app => {
    const { router, controller } = app;
    const UserInterceptor = app.middleware.userInterceptor({}, app);
    const AdminInterceptor  =app.middleware.adminInterceptor({},app);
    const UserTokenId = app.middleware.userTokenId({},app);
     
    
    
    router.post('/Api/registe', controller.userOther.creat);//web上注册的,取推荐码 待完善
    router.post('/Api/getVerify', controller.userOther.getWebVeriCode);//获取验证码 
    // router.post('/webApi/v1/delete', controller.userOther.index);
    router.get('/webApi/v1/changeStatus', AdminInterceptor,controller.userOther.changeStatus);//开启/禁用用户    
    router.get('/webApi/v1/getAllUser',AdminInterceptor, controller.userOther.getAllUser);//分页 ?page=1&pageNum=2 ,
    router.post('/webApi/v1/openVIP', AdminInterceptor,controller.userOther.openVIP);//开通会员 //  
    router.post('/webApi/v1/clearVIP', AdminInterceptor,controller.userOther.clearVIP);//开通会员 // 
    // router.post('/webApi/v1/adminLogin', controller.userOther.adminLogin);//后台登录专用XX
    router.post('/webApi/v1/adminLoginApp', controller.userOther.adminLoginApp);//APP管理后台登录专用
    router.get('/webApi/v1/adminLoginOut', controller.userOther.adminLoginOut);//后台登出
    // router.post('/appApi/v1/webDelLeaveMessage', controller.userOther.webDelLeaveMessage);// 用户获取自己的留言 
    router.post('/webApi/v1/getVerify', controller.userOther.getWebVeriCode);//获取验证码 
 
    router.post('/webApi/v1/webGetPersonInfo', AdminInterceptor,controller.userOther.webGetPersonInfo);//查个人信息 开vp
    
    
    
    
    router.get('/webApi/v1/getApplicatioWithdrawal',AdminInterceptor, controller.userOther.getApplicatioWithdrawal);// OK申请列表
    router.post('/webApi/v1/deleApplication',AdminInterceptor, controller.userOther.deleApplicatioWithdrawal);// 删除申请
    router.get('/webApi/v1/getUserQR',AdminInterceptor, controller.userOther.getUserQR);//查看用户收 信息 OK
    router.post('/webApi/v1/enterApplication',AdminInterceptor, controller.userOther.enterApplication);// 确认fu 和留言

    router.post('/webApi/v1/leaveMessage',AdminInterceptor,  controller.userOther.leaveMessage);//  留言给ta
    
    
    //app
    router.post('/appApi/v1/getLeaveMessage',UserInterceptor, controller.userOther.getLeaveMessage);// 用户获取自己的留言 
    router.post('/appApi/v1/delLeaveMessage', UserInterceptor,controller.userOther.delLeaveMessage);// 删除用户留言  
    router.get('/appApi/v1/userHead',UserInterceptor, controller.user.getUserInfo);// 用户信息     //  
    router.post('/appApi/v1/saveInfo',UserInterceptor, controller.user.saveInfo);// 编辑保存用户资料 
    router.post('/appApi/v1/getMyBalance',UserInterceptor, controller.user.getMyBalance);// 用户的余额 奇怪get 获取不到参数
    router.post('/appApi/v1/applicatioWithdrawal',UserInterceptor, controller.user.applicatioWithdrawal);// 用户申请
    router.post('/appApi/v1/isOrderBuy',UserInterceptor, controller.user.isOrderBuy);// 先查用户是否下单
    router.post('/appApi/v1/orderBuy', UserInterceptor,controller.user.orderBuy);// 用户下单
    router.post('/appApi/v1/getMyOrderBuy', controller.user.getUserOrderBuy);// 查用户下过的单 UserInterceptor,
     //

    router.get('/webApi/v1/getAllOrderBuy',AdminInterceptor, controller.userOther.getAllOrderBuy);// web查所有用户 
    router.post('/webApi/v1/delOneOrder',AdminInterceptor, controller.userOther.delOneOrder);// web删除用户下的单,并给留言
    
    router.post('/appApi/v1/verifyPsw', controller.user.verifyPsw);// 验证用户密码 改为APP内验证

    // router.post('/appApi/v1/login2',UserInterceptor,controller.testAPI.jwtTest);

    router.post('/appApi/v1/getVerify', controller.user.getVerify);//获取验证码  
    router.post('/appApi/v1/register', controller.user.creat);//APP上注册的
    router.post('/appApi/v1/login', controller.userOther.login);//APP登录
    router.post('/appApi/v1/changePassword', UserInterceptor,controller.userOther.changePassword);//APP 
    router.post('/appApi/v1/findPassword', controller.userOther.findPassword);//APP找回密码
    
    router.post('/appApi/v1/signIn', UserInterceptor,controller.user.signIn);//APP 用户打卡
    router.post('/appApi/v1/userProfit',UserInterceptor, controller.user.userProfit);//APP 用户收益 历史
    
    
    
    
    // router.post('/webApi/v1/upload', controller.upload.upload);//单图片上传 保留 
    router.post('/webApi/v1/uploadImg', controller.upload.uploadImg);// 图片上传OK
    router.post('/webApi/v1/delFile', controller.upload.delFile);//单图片删除
    router.post('/webApi/v1/readDir', controller.upload.readDir);//读文件夹

    
    // router.post('/mutiUpload', controller.upload.mutiUpload);//多图片上传 保留
// 文件上传删除
// router.post('/webApi/v1/ajaxupload', controller.upload.ajaxUpload);
// router.post('/webApi/v1/bufferupload', controller.upload.bufferUpload);
// router.post('/webApi/v1/formupload', controller.upload.formUpload);
// router.post('/webApi/v1/multipleupload', controller.upload.multipleUpload);
// router.post('/webApi/v1/delfile', controller.upload.delFile);
// router.post('/webApi/v1/delfiles', controller.upload.delFiles);
//     //test
    router.get('/webApi/v1/find', controller.user.find);//分页 ?page=1&pageNum=2

    router.get('/webApi/v1/testToken', controller.testAPI.testToken);
    router.post('/appApi/v1/testor',UserTokenId,  controller.testAPI.index);// 测试专用  
    
};